package com.robot.admin.client;

import com.robot.admin.client.impl.MerchantClientImpl;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import java.util.Map;

/**
 * @author lin
 */
@Component
@FeignClient(value = "robot-merchant", fallback = MerchantClientImpl.class)
public interface MerchantClient {
    /**
     * 店铺列表并分页和条件查询
     *
     * @param searchMap
     * @param page
     * @param size
     * @return
     */
    @PostMapping(value = "store/third/findStores/{page}/{size}", produces = "application/json; charset=utf-8")
    String thirdFindStores(@RequestBody Map searchMap, @PathVariable int page, @PathVariable int size);

    /**
     * 店铺详情
     *
     * @param id
     * @return
     */
    @GetMapping(value = "store/third/findStoreById/{id}", produces = "application/json; charset=utf-8")
    String thirdFindStoreById(@PathVariable String id);

    /**
     * 通过phone查询店铺详情
     *
     * @param phone
     * @return
     */
    @GetMapping(value = "store/third/findStoreByPhone/{phone}", produces = "application/json; charset=utf-8")
    String thirdFindStoreByPhone(@PathVariable String phone);

    /**
     * 增加店铺
     *
     * @param store
     */
    @PostMapping(value = "store/third/addStore", produces = "application/json; charset=utf-8")
    void thirdAddStore(@RequestBody String store);

    /**
     * 编辑店铺
     *
     * @param store
     */
    @PutMapping(value = "store/third/updateStore")
    @Transactional(rollbackFor = Exception.class)
    void thirdUpdateStore(@RequestBody String store);


    /**
     * 查找今日入驻商家
     *
     * @param page
     * @param size
     * @return
     */
    @PostMapping(value = "store/third/findStoresByToday/{page}/{size}", produces = "application/json; charset=utf-8")
    String thirdFindStoresByToday(@PathVariable int page, @PathVariable int size);

    /**
     * 查找昨日入驻商家
     *
     * @param page
     * @param size
     * @return
     */
    @PostMapping(value = "store/third/findStoresByYesterday/{page}/{size}", produces = "application/json; charset=utf-8")
    String thirdFindStoresByYesterday(@PathVariable int page, @PathVariable int size);

    /**
     * 查找最近7日入驻商家
     *
     * @param page
     * @param size
     * @return
     */
    @PostMapping(value = "store/third/findStoresByWeek/{page}/{size}", produces = "application/json; charset=utf-8")
    String thirdFindStoresByWeek(@PathVariable int page, @PathVariable int size);

    /**
     * 根据时间段查找总入驻商家
     *
     * @param searchMap
     * @param page
     * @param size
     * @return
     */
    @PostMapping(value = "store/third/findStoresByBetweenAnd/{page}/{size}", produces = "application/json; charset=utf-8")
    String thirdFindStoresByBetweenAnd(@RequestBody Map searchMap, @PathVariable int page, @PathVariable int size);

    /**
     * 查找总入驻商家
     *
     * @param page
     * @param size
     * @return
     */
    @PostMapping(value = "store/third/findStoresByTotal/{page}/{size}", produces = "application/json; charset=utf-8")
    String thirdFindStoresByTotal(@PathVariable int page, @PathVariable int size);

    /**
     * 通过agentId查找商户
     *
     * @param agentId
     * @return
     */
    @GetMapping(value = "company/third/findCompaniesByAgentId/{agentId}", produces = "application/json; charset=utf-8")
    String thirdFindCompaniesByAgentId(@PathVariable String agentId);

    /**
     * 增加company
     *
     * @param company
     */
    @PostMapping(value = "company/third/addCompany", produces = "application/json; charset=utf-8")
    void thirdAddCompany(@RequestBody String company);

    /**
     * 商家行业列表
     *
     * @return
     */
    @GetMapping(value = "industry/third/findIndustries", produces = "application/json;charset=utf-8")
    String thirdFindIndustries();

    /**
     * 根据id查找行业
     *
     * @param id
     * @return
     */
    @GetMapping(value = "industry/third/findIndustryById/{id}", produces = "application/json;charset=utf-8")
    String thirdFindIndustryById(@PathVariable String id);

    /**
     * 根据行业名称查找行业
     *
     * @param industry
     * @return
     */
    @RequestMapping(value = "industry/third/findIndustryByName", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
    String thirdFindIndustryByName(@RequestBody String industry);

    /**
     * 增加行业
     *
     * @param industry
     */
    @RequestMapping(value = "industry/third/addIndustry", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
    void thirdAddIndustry(@RequestBody String industry);

    /**
     * 修改行业
     *
     * @param industry
     */
    @RequestMapping(value = "industry/third/updateIndustry", method = RequestMethod.PUT, produces = "application/json;charset=utf-8")
    void thirdUpdateIndustry(@RequestBody String industry);

    /**
     * 删除行业
     *
     * @param id
     */
    @RequestMapping(value = "industry/third/deleteIndustryById/{id}", method = RequestMethod.DELETE, produces = "application/json;charset=utf-8")
    void thirdDeleteIndustryById(@PathVariable String id);
}
